package com.yfp.machine.service.impl;

import com.yfp.machine.domain.PositionType;
import com.yfp.machine.mapper.PositionTypeMapper;
import com.yfp.machine.service.PositionTypeService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * 点位类型表(PositionType)表服务实现类
 *
 * 
 * @since 2023-12-21 20:53:04
 */
@Service("positionTypeService")
public class PositionTypeServiceImpl implements PositionTypeService {
    @Resource
    private PositionTypeMapper positionTypeMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param positionTypeId 主键
     * @return 实例对象
     */
    @Override
    public PositionType queryById(String positionTypeId) {
        return this.positionTypeMapper.queryById(positionTypeId);
    }

    /**
     * 分页查询
     *
     * @param positionType 筛选条件
     * @return 查询结果
     */
    @Override
    public List<PositionType> queryByPage(PositionType positionType) {
        return this.positionTypeMapper.queryAllByLimit(positionType);
    }

    /**
     * 新增数据
     *
     * @param positionType 实例对象
     * @return 实例对象
     */
    @Override
    public PositionType insert(PositionType positionType) {
        this.positionTypeMapper.insert(positionType);
        return positionType;
    }

    /**
     * 修改数据
     *
     * @param positionType 实例对象
     * @return 实例对象
     */
    @Override
    public PositionType update(PositionType positionType) {
        this.positionTypeMapper.update(positionType);
        return this.queryById(positionType.getPositionTypeId());
    }
}
